Websydian v6.1 online documentationOnline documentation - WebsydianExpress v3.5

The WSYTMPL model

Introduction

The WSYTMPL model contains definitions for API functions that is used by the _CreateTemplates function to create the XML definitions file.

This model is used as a library model for WSYAPI.

These API functions are not implemented in the WSYTMPL model, they are just non-implemented functions that define the implementation name and interface of the functions.

The main reason for not implementing the functions in the WSYTMPL functions is that these functions are created using the TransacXML pattern libraries. These libraries have a separate license, that has nothing to do with the web development otherwise present in WSYAPI. If the "real" model was to be added as a library model to WSYAPI, it would mean that all customers you would want to develop for WebsydianExpress would also need to have a TransacXML developer license - which is not a reasonable demand.

This document contains a short description of the API's that are contained in the WSYAPI model. Some of these APIs are useful for adding information to the XML document in your own version of the XML template generation, while most of them primarily can be be used to understand the present functionality of the XML template generation.

API description

General information

Most APIs write or read elements in the XML document.

To specify the XML document currently being handled they will have an input variable Document that will contain the references needed to handle the document. Map these with the information found in the local variable Document in the XMLTemplateGenerator function.

InsertRow APIs

As the main aim of the APIs in the WSYTMPL model is to create the XML template, most of the APIs naturally will write information to the XML document. These are the InsertRow APIs.

These API's creates and inserts an element with the name of the function scoping the InsertRow function.

The exception for this is the InputField and OutputField scoping functions - both will create elements named Field - but with different attributes.

For InsertRow functions, you must specify the parent element which you want the created element to be a child element of. This reference will have been an output parameter for the InsertRow function that created the parent element - however, you should note that this information in many cases will be available in a local variable. See how the API you want to call has been called in the existing functionality to see how to map this parameter.

Some of the scoping functions (e.g. Option) contain a function that is just called InsertRow and one that is called ScopingFunctionFamesInsertRow. In these cases the long named function inserts a container element that has no attributes or simple element. The only aim is to insert a parent element that will contain all the instance elements.

E.g. for Option:

 

Event.FindEventFromImplName

Identifies an Event element based on an identification of the Region element that it is scoped by, and the value plex_impl attribute of the Event element.

Event.GetFirstOccurrence

This retrieves the location of the first Event element under a specific parent (or in the entire document if null is specified for the parent element).

This is used to insert Field elements that has been copied from the Field element scoped by an element to a location just before the Event elements in the current region.

Event.SingleFetch

This retrieves information for a specific Event element in the XML document. The input must specify an Event element or an error will be returned. Use the GetFirstOccurrence or FindEventFromInplName APIs to find the identification of the Event.

InputField.FindInputFieldFromImplName

This API can find an Field element that has the value input for the attribute plex_roleinpage and the specified input parameter for the plex_impl field as the value of the plex_impl attribute.

InputField.GetFirstOccurrence

This retrieves the location of the first Field element under a specific Event (or in the entire document if null is specified for the parent element).

InputField.SingleFetch

This retrieves information for a specific Field element in the XML document. The input must specify an Field element or an error will be returned. Use the GetFirstOccurrence or FindInputFieldFromInplName APIs to find the identification of the Field.

OutputField.DeleteRow

This API deletes a specific Field element from the XML document. It is used in the case where an input field has been copied to the region - in these cases the corresponding output field will be deleted to avoid having the same field as both input and output.

OutputField.FindOutputFieldFromImplName

This API can find an Field element that has the value output for the attribute plex_roleinpage and the specified input parameter for the plex_impl field as the value of the plex_impl attribute.

System.AddSeparator

This is a helper function that ensures that a file system separator ("/" or "\") is inserted as the last character of a file path. This is normally called before the file path and file name is concatenated.

System.AppendChild

This function can append an element to another element in the XML document. You can use this if you want to add a cloned element to the document.

The element will be inserted as the last child of the parent element.

For an example see the subroutine "Write InputField to Region" in the XMLTemplateGenerator.

System.CloneElement

An element can only be added to one location in the document. This function enables you to create a copy of an element (and optionally of all its sub elements) that you can then append to another parent element.

For an example see the subroutine "Write InputField to Region" in the XMLTemplateGenerator.

System.DestroyEnvironment

This removes all the memory objects that contains the current XML document definitions. You should only ever call this if you of some reason force an exit from the XMLTemplateGenerator without going through the Terminate subroutine.

System.ErrorPop

This API retrieves all the errors reported by the TransacXML runtime.

In the subroutine "Get errorstack", calls to this API is already implemented - so in most cases, you should just call this subroutine if you want to retrieve the errors.

System.ExecuteTemplateGenerator

This API calls the runtime functions that handles the conversion of the generated XML template to the final HTML / JS / JSON templates.

You should probably never call this yourself unless you are creating a version of the XML template generator that does not inherit from the abstract function.

System.InitializeEnvironment

This creates the memory store necessary for handling the XML document.

You should probably never call this yourself unless you are creating a version of the XML template generator that does not inherit from the abstract function.

System.InsertBefore

This API inserts an element as a child element of  a parent. The element will be inserted just before the existing element (specified in the variable InsertBeforeThisElement).

System.InsertBefore

A (Java) helper function that reads information from a property file.

System.JavaReadPropertyFile

Reads a named property from a specific Java property file.

System.NormalizePathPathSeparators

This is a helper function, that ensures that a file path contains the "correct" path separators for the current environment.

System.ReportError

This function is called whenever the XMLTemplateGeneration should report an error.

You can call this API if you in your own customized functionality want to report an error.

System.SaveFile

This function saves the specified XML document to a file.

You can use it if you want to investigate the XML document structure at a specific time in the XML template generation.

System.SetAttribute

This is potentially the most useful API for extending the XML template generation. This API allows you to add attributes to any element in the document. So if you for instance need some information about a field that the current meta code in the XMLTemplateGenerator does not extract and/or write to the document, you can add your own meta code to find the information - and then use this API to add the information as an attribute of the Field element.

You can retrieve the attribute values in you meta templates by using the %GETVALUE or %@ replacement markers.

System.StartsWith

A helper function that determines whether a string starts with a specific string.